package com.tarena.poem;

import java.math.BigInteger;
import java.math.MathContext;
import java.util.UUID;

import javax.swing.JApplet;

import com.sun.org.apache.bcel.internal.generic.NEW;

public class Poem {

	private char[][] f;
	private String poem = null;

	public Poem() {
		this(null);
	}

	public Poem(String poem) {
		this(new char[4][7], poem);
	}

	public Poem(char[][] f, String poem) {
		this.f = f;
		this.poem = poem;
	}

	public void up2down() {
		this.f = new char[4][7];
		int h = 0;
		for (int i = 0; i < f.length; i++) {
			for (int j = 0; j < f[0].length; j++) {
				f[i][j] = poem.charAt(h++);
			}
		}
	}

	public void right2left() {
		this.f = new char[7][4];
		int h = 0;
		for (int j = f[0].length - 1; j >= 0; j--) {
			for (int i = 0; i < f.length; i++) {
				f[i][j] = poem.charAt(h++);
			}
		}
	}

	public void print() {
		for (int i = 0; i < f.length; i++) {
			for (int j = 0; j < f[0].length; j++) {
				System.out.print(f[i][j]);
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
//		String poemStr = "���ǰ׵۲��Ƽ�ǧ�ｭ��һ�ջ�����Գ���䲻ס�����ѹ�����ɽ";
//		Poem poem = new Poem(poemStr);
//		poem.up2down();
//		poem.print();
//		System.out.println();
//		poem.right2left();
//		poem.print();
//		String string = "13254345";
//		
//		System.out.println(string.matches("^[-]?[\\d][\\d]*$"));
//		
//		Integer.valueOf(string);
//		
//		System.out.println(UUID.randomUUID().toString());
//		System.out.println(UUID.randomUUID().toString());
//		System.out.println(UUID.randomUUID().toString());
//		System.out.println(UUID.randomUUID().toString().length());
		
		String action = "//";
		while (true){
			if (action.startsWith("/")) {
				action = action.substring(1);
			} else {
				break;
			}
		}
		System.out.println(action);
		
		int sum = 36;
		int pageSize = 9;
		
		int abc = (int) Math.ceil((double)sum / (double)pageSize);
		//System.out.println(abc);
		
		//System.out.println(Integer.MAX_VALUE);
		//System.out.println(Integer.MIN_VALUE);
		//2*3*5*7*11*13*17*19*23*29*31*37*41*43*47*53*59*61*67*71
		//System.out.println(37*41*43*47*53*59*61*67*71);//*37*41*43*47*53*59*61*67*71
		
		//System.out.println("---------------------");
		int a = 15, b = 8;
		int c = a | b;
		int d = 4;
		int max = Integer.MAX_VALUE;
		//System.out.println(a + " | " + b + " = " + c);
		//System.out.println(c + " & " + d + " = " + (c & d));
		//System.out.println(Integer.bitCount(max));
		//System.out.println(Integer.toBinaryString(max));
		//System.out.println(max);
		int max2 = Integer.parseInt("1000000000000000000000000000000", 2);
		//System.out.println(max2);
		//System.out.println(Integer.toBinaryString(Integer.MIN_VALUE));
	}
}
